﻿/****************************** Module Header ******************************\
 * Module Name:  DebugHelper.cs
 * Module Version:  1.0.0 (2012-9-21)
 * Copyright (c) AnyEB.Com (14507247@qq.com)
 * 
 * This class is used to process the DebugHelper.
 * 
 * This source is subject to the GPL License.
 * See http://www.gnu.org/licenses/gpl.html.
 * All other rights reserved.
 * 
 * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, 
 * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED 
 * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
\***************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace UCF.Core
{
    public class DebugHelper
    {
        private static readonly Lazy<Web.WebDebugHelper> webdebug = new Lazy<Web.WebDebugHelper>(() => new Web.WebDebugHelper());
        public static Web.WebDebugHelper Web { get { return webdebug.Value; } }

        private static readonly Lazy<Forms.FormDebugHelper> formdebug = new Lazy<Forms.FormDebugHelper>(() => new Forms.FormDebugHelper());
        public static Forms.FormDebugHelper Forms { get { return formdebug.Value; } }


        /// <summary>
        /// 保存到日志
        /// </summary>
        /// <param name="msg"></param>
        /// <param name="logfolder"></param>
        public static void Log(string msg, string logfolder = "C:")
        {
            FileHelper.AppendToFile(string.Format("{1}DateTime:{0}{1}{2}{1}", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), Environment.NewLine, msg), string.Format("{0}\\{1}.txt", logfolder, DateTime.Today.ToString("yyyyMMdd")));
        }
    }
}
